function decreaseQuantity() {
    let quantityInput = document.getElementById('quantityInput');
    let currentQuantity = parseInt(quantityInput.value);

    if (currentQuantity > 1) {
        quantityInput.value = currentQuantity - 1;
    }
}

function increaseQuantity() {
    let quantityInput = document.getElementById('quantityInput');
    let currentQuantity = parseInt(quantityInput.value);
    let maxQuantity = parseInt(quantityInput.getAttribute('max'));

    if (currentQuantity < maxQuantity) {
        quantityInput.value = currentQuantity + 1;
    }
}

function addToCart() {
    var selectedSize = $("input[name='size']:checked").val();
    if (!selectedSize) {
        alert('请选择尺码！');
        return;
    }

    var deliveryMethod = $("input[name='delivery']:checked").val();
    if (!deliveryMethod) {
        alert('请选择配送方式！');
        return;
    }

    alert('已成功添加到购物车！');
}